#pragma once

#include"list.h"

namespace fengxi
{
	template<class T,class Container = list<T>>
	class queue
	{
	public:
		void push(const T& x)
		{
			_con.push_back(x);
		}
		void pop()
		{
			_con.pop_front();
		}
		T& top()
		{
			return _con.front();
		}
		bool empty()
		{
			return size() == 0;
		}
		size_t size()
		{
			return _con.size();
		}
	private:
		Container _con;
	};

	void test_queue()
	{
		queue<int> q;
		q.push(1);
		q.push(10);
		q.push(100);
		q.push(1000);
		q.push(10000);
		std::cout << q.size() << std::endl;
		while (!q.empty())
		{
			std::cout << q.top() << std::endl;
			q.pop();
		}
		std::cout << q.size() << std::endl;
	}
}
